﻿@using ZBJF.Warranty.BLL
@using EnumHelper = ZBJF.Warranty.Common.Common.EnumHelper
@using ZBJF.Warranty.Common.Enums.InfoCollect
@using ZBJF.Warranty.Common.Enums.System
@model  ZBJF.Warranty.Model.InsuranceWarrantyRecord
@{
    byte bendTheRulesWith;
    byte.TryParse(PageData["BendTheRulesWith"] == null ? "" : PageData["BendTheRulesWith"].ToString(), out bendTheRulesWith);
    if (bendTheRulesWith < 1)
    {
        byte.TryParse(ViewBag.BendTheRulesWith == null ? "" : ViewBag.BendTheRulesWith.ToString(), out bendTheRulesWith);
    }
}
<div id="divBendTheRulesRecordInfo">
    <h4>通融历史</h4>
    <table class="table table-responsive table-bordered table-hover">
        <tr>
            <th>通融类型</th>
            <th>通融理赔员</th>
            <th>通融详情</th>
            <th>查看图片</th>
            <th>上传人</th>
            <th>操作</th>
        </tr>
        @{
            var insuranceWarrantyBendTheRulesRecordList = Model.InsuranceWarrantyBendTheRulesRecord.Where(o => bendTheRulesWith <= 0 || o.BendTheRulesWith == bendTheRulesWith).ToList();
            for (int i = 0; i < insuranceWarrantyBendTheRulesRecordList.Count; i++)
            {
                var insuranceWarrantyBendTheRulesRecord = insuranceWarrantyBendTheRulesRecordList[i];

                if (insuranceWarrantyBendTheRulesRecord != null)
                {
                    var uploadFiles = ServiceFactory.UploadFilesServiceInstance.GetFiles(NeedUploadFileDataTableEnums.InsuranceWarrantyBendTheRulesRecord, insuranceWarrantyBendTheRulesRecord.ID);
                    var imageUrls = uploadFiles.Any() ? uploadFiles.Select(o => o.FilePath).ToList().Aggregate(string.Empty, (c, d) => c + ';' + d).Trim(';') : "";
                    <tr>
                        <td>
                            @EnumHelper.Instance.GetDescription(typeof(BendTheRulesWithType), insuranceWarrantyBendTheRulesRecord.BendTheRulesWith)
                        </td>
                        <td>
                            @insuranceWarrantyBendTheRulesRecord.InsuranceCompanyBendTheRulesLossAdjusterName
                        </td>
                        <td>
                            @(insuranceWarrantyBendTheRulesRecord.Remark)
                        </td>
                        <td>
                            <a class="Edit-R" href="javascript:void(0);" onclick="showImageLayer(this, 'MultiImageLook.html')" imgurl="@(imageUrls)">
                                查看图片
                            </a>
                        </td>
                        <td>
                            @(insuranceWarrantyBendTheRulesRecord.CreatedBy)
                        </td>
                        <td><a href="javascript:void(0)" onclick="deleteImage(this, @insuranceWarrantyBendTheRulesRecord.ID);">删除</a></td>
                    </tr>
                }
            }
        }
    </table>
</div>